package com.molichuxing.services.infrastructure.service.impl;

import com.alibaba.fastjson.JSON;
import com.molichuxing.framework.dto.Paged;
import com.molichuxing.services.infrastructure.bean.CarBean;
import com.molichuxing.services.infrastructure.convertor.Convert;
import com.molichuxing.services.infrastructure.dao.CarMapper;
import com.molichuxing.services.infrastructure.dao.LicencePlateMapper;
import com.molichuxing.services.infrastructure.dto.request.create.LicencePlateCreateDto;
import com.molichuxing.services.infrastructure.dto.request.modify.LicencePlateModifyDto;
import com.molichuxing.services.infrastructure.dto.response.CarDto;
import com.molichuxing.services.infrastructure.dto.response.LicencePlateDto;
import com.molichuxing.services.infrastructure.service.CarService;
import com.molichuxing.services.infrastructure.service.LicencePlateService;
import com.molichuxing.services.property.CarLicencePlateStatusEnum;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 车牌 服务实现类
 * </p>
 *
 * @author 
 * @since 2019-08-15
 */
@Service("licencePlateService")
public class LicensePlateServiceImpl implements LicencePlateService {

  private static final Logger log = Logger.getLogger(LicensePlateServiceImpl.class);

  @Resource
  private LicencePlateMapper licencePlateMapper;

  @Override
  public LicencePlateDto getLicensePlateByCarId(Integer carId) {
    return Convert.toLicencePlateDto(licencePlateMapper.getById(carId));
  }

  @Override
  public int createLicensePlate(LicencePlateCreateDto createDto) {
    return licencePlateMapper.create(Convert.toLicencePlateBean(createDto));
  }

  @Override
  public int modifyLicensePlate(LicencePlateModifyDto modifyDto) {
    return licencePlateMapper.modify(Convert.toLicencePlateBean(modifyDto));
  }


}
